package com.aiit.mapper;

import com.aiit.pojo.Role;
import com.aiit.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: LuTao
 * @Date: 2022/05/04/8:58
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    //通过用户名发现角色
    List<Role> findRolesByUsername(@Param("username") String username);
    //根据条件分页查询用户
    List<User> getAllByCondition(@Param("count") long count,
                                 @Param("limit") Long limit,
                                 @Param("username") String username,
                                 @Param("role") String role,
                                 @Param("locked") String locked,
                                 @Param("startTime") String startTime,
                                 @Param("endTime") String endTime);
    //根据条件分页查询用户数量
    Long getCountByCondition(@Param("username") String username,
                             @Param("role") String role,
                             @Param("locked") String locked,
                             @Param("startTime") String startTime,
                             @Param("endTime") String endTime);

}
